package com.example.zookeeper.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2021/9/2 13:28
 */
@EnableScheduling
@Configuration
public class ScheduleConfig {

    @Bean
    public TaskScheduler scheduler() {
        ThreadPoolTaskScheduler taskExecutor = new ThreadPoolTaskScheduler();
        taskExecutor.setPoolSize(4);
        taskExecutor.setThreadNamePrefix("scheduled_");
        return taskExecutor;
    }
}
